package com.liseen.utils
{
	import flash.utils.ByteArray;

	public class Utils
	{
		public function Utils()
		{
		}
		
		public static function ReadString(_arg1:ByteArray):String
		{
			var _local2:* = 0;
			var _local3:* = _arg1.position;
			while (_local3 < _arg1.length)
			{
				if (_arg1[_local3] == 0)
				{
					_local2 = ((_local3 - _arg1.position) + 1);
					break;
				}
				_local3++;
			}
			if (_local2 > 0)
			{
				return (_arg1.readMultiByte(_local2, "cn-gb"));
			}
			return ("");
		}
		
		public static function WriteString(array:Array,des:ByteArray):void
		{
			var index:int=0;
			while(index<array.length){
				des.writeMultiByte(array[index],"cn-gb");
				
				if(index==array.length-1){
					des.writeByte(0);
				}else{
					des.writeMultiByte(",","cn-gb");
				}
				index++;
			}	
		}
		
		
	}
}